<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
	body{
		background-image:url(img/101.jpg);
		background-size:cover;
	}
	h2{
		text-align:center;
		color:#fff;
	}
	table,#operate{
		width:80%;
		margin:0 auto;
		color:#fff;
		background-color:rgba(0,0,0,.3);
	}
	#operate{
		width:4%;
		margin-left:10%;
	}
	tr,td,th,table{
		border:1px solid silver;
		border-collapse:collapse;
	}
	tr:hover{
	    background-color:rgba(255,255,255,0.5);
	    cursor:pointer;
	}
</style>
</head>
<body>
	<h2>在线考试系统</h2>
	<div id="operate">
		<button onClick="add()">添加</button>
	</div>
	<br/>
	<table>
		<tr>
			<th>用户编号</th>
			<th>用户姓名</th>
			<th>用户角色</th>
			<th>操作</th>
		</tr>
		<c:forEach var="u" items="${us }">
			<tr>
				<td>${u.uId }</td>
				<td>${u.uName }</td>
				<td>${u.uRole }</td>
				<td>
					<button onClick="del(${u.uId})">删除</button>
					<button onClick="updateShow(${u.uId })">修改</button>
			</tr>
		</c:forEach>
	</table>
	
	<script>
		function add(){
			location.href="add.jsp";
		}
		function del(id){
			location.href="userDel?id="+id;
		}
		function updateShow(id){
			console.log("修改");
			location.href="userUpdateShow?id="+id;
		}
	</script>
</body>
</html>